home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8" ?>
- <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
- <stack>
- <name>in</name>
- <id>-1</id>
- <cardCount>1</cardCount>
- <cardID>2927</cardID>
- <listID>4006</listID>
- <cantModify><false /></cantModify>
- <cantDelete><false /></cantDelete>
- <cantAbort><false /></cantAbort>
- <cardSize>
- <width>512</width>
- <height>342</height>
- </cardSize>
- <script>--This stack demonstrates how HyperCard can be used with MacHTTP to
- --provide searching functions.
-
- -- This stack is used by placing a copy of HyperCard 2.1 or greater,
- -- (or an alias to the HyperCard applicaiton) named
- -- HyperCard.exe in the MacHTTP folder with this stack, named "Home".
- -- The URL to access the stack is http://your.address/HyperCard.exe
- -- Note that this script doesn't return a properly formatted HTTP/1.0
- -- header. See the AppleScript examples for how to do this.
-
- on appleEvent class, eventID, sender
- put "Handling event!" & sender
- if class & eventID is "WWWΩsrch" then --this is the MacHTTP event code
- request ae data
- if the result is not empty then
- reply "Error -- no data!."
- exit appleEvent
- end if
- put it into searchStr
- put it into field "data"
- get GlobalWWWSearch(searchStr) -- process it
- reply it -- send back the reply
- else pass appleEvent -- we don't recognize this event; pass it on
- end appleEvent
-
- -- A skeleton search function. Notice it returns the search prompt
- -- when the searchStr parameter is empty.
-
- function GlobalWWWSearch searchStr
- if searchStr is empty then
- return "<HEAD><ISINDEX><TITLE>Search Documents</TITLE></HEAD>" & ¬
- "<h1>Enter a single keyword</h1><p>Partial words are OK.<p>"
- else
- -- get search(searchStr) -- whatever you need to do to searcg is done here
- return "<HEAD><TITLE>Search Results</TITLE></HEAD>" & ¬
- "<H1>Search</H1>The following documents contain " & searchStr & ¬
- ":<P>" & it & "<P>"
- end if
- end GlobalWWWSearch
-
- on openStack
- set the userlevel to 5
- pass openStack
- end openStack
-
- </script>
- <background id="2713" file="background_2713.xml" name="" />
- <card id="2927" file="card_2927.xml" marked="false" name="" owner="2713" />
- </stack>
-